﻿package com.ease.model.type
{
	import com.ease.common.enums.TextualEnum;
	import com.ease.lang.Enum;
	import com.ease.lang.EnumConstants;
	import com.ease.model.type.DatabaseConstraintType;

	[Bindable]
	[RemoteClass(alias="com.ease.model.type.DatabaseConstraintType")]

	public class DatabaseConstraintType extends Enum
	{
		/* static init */
		{ initEnum(DatabaseConstraintType); }

		/* Constants */
		public static const C:DatabaseConstraintType = new DatabaseConstraintType("C", "CheckConstraintOnATable");
		public static const P:DatabaseConstraintType = new DatabaseConstraintType("P", "PrimaryKey");
		public static const U:DatabaseConstraintType = new DatabaseConstraintType("U", "UniqueKey");
		public static const V:DatabaseConstraintType = new DatabaseConstraintType("V", "withCheckOptionOnAView");
		public static const O:DatabaseConstraintType = new DatabaseConstraintType("O", "withReadOnlyOnAView");
		public static const R:DatabaseConstraintType = new DatabaseConstraintType("R", "ReferentialIntegrity");

		private var _text:String;

		/*public*/ function DatabaseConstraintType(name:String=null ,text:String=null) {
			super.name = name;
			this._text = text;
		}

		public function get text():String  { return this._text; }

		/* constant query */
		public static function getEnumConstants():Array {
			return Enum.getEnumConstants(DatabaseConstraintType);
		}

		public static function get(constantName:String, caseSensitive:Boolean = false):DatabaseConstraintType {
			return DatabaseConstraintType(Enum.get(DatabaseConstraintType, constantName, caseSensitive));
		}
	}
}